<?php
header('Content-Type:text/html;charset=UTF-8');

session_start();

if(isset($_SESSION['user'])){
	
}else {
	die('<h3>登录信息不完整</h3><a href="/index.php">返回重新登录</a>');
};

@$text = $_REQUEST['text'];

$entrySelectSql = 'select e.id as eId,e.name as eName,price,imgUrl,t.name as tName from entry as e join type as t on e.typeId=t.id';

$entrySqlWhere = " where e.name like concat('%',:text,'%')";

$entrySelectData = array();

$entrySqlOrder = ' order by e.id asc';

if(!empty($text)){
	$entrySelectSql .= $entrySqlWhere;
	$entrySelectData['text'] = $text;
}

$entrySelectSql .= $entrySqlOrder;



require 'lib/db.php';

@$list = dbSelectAll($entrySelectSql,$entrySelectData);

@$carts = dbSelectAll('select entryId,ordersId from cart');

@$orders = dbSelectAll('select id,name from orders');



// @$list = dbSelectAll('select e.id as eId,e.name as eName,price,imgUrl,t.name as tName from entry as e join type as t on e.typeId=t.id');
?>

<!DOCTYPE html>
<html>
   <head>
      <title>SuperMarket</title>
	  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" charset="UTF-8" >
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <script src="bootstrap/js/jquery-1.11.1.min.js"></script>
      <script src="bootstrap/js/bootstrap.min.js"></script>
      <!--[if lt IE 9]>
         <script src="js/html5shiv.js"></script>
         <script src="js/respond.min.js"></script>
      <![endif]-->
   </head>
<script>

</script>
   <style>
   .you{border:solid 1px; width: 300px;height:200px;float: left}
   #a{color:#62b0ff;}
   .title{border:solid 0px;height:4px;width:1135px;background:#000000;}
   .main{background:#89dcd6;color:red;height:500px;text-align:center}
   .type{text-align: center}
   .name{color:#000000;}
   #price{color:red;}
   .list{width:90px;height:80px;border-radius:80px;margin:13px;background:white;}
   .deep{margin:14px}
   #color{color:gray}
   .search{height:50px;width: 870px;background:;}
   #searInput{border:groove 5px;height:37px}
   #input{border:groove}
   .From{margin:0px;}
   .Hpage{border:solid 0px;height:auto;width:875px}
   .picture{border:solid 1px;height:40px;width:400px;float:right}
   #div{height:25px;width:150px;color:blue}
   #searchForm{float:left}
  </style>
   <body>
<div class="navbar navbar-default">
  <div class="container">
  	<a class="navbar-brand glyphicon glyphicon-shopping-cart" href="First.php" id="a">宜家超市</a>
  		<ul class="nav navbar-nav">
  			<li class="dropdown">
  				<a href="#" class="dropdown-toggle" data-toggle="dropdown" >档案管理 <span class="caret"></span></a>
  					<ul class="dropdown-menu">
  					<li><a href="manager.php">职工列表</a></li>
  					<li><a href="member.php">管理员</a></li>
  					</ul>
  			</li>
  		  </ul>
		<ul class="nav navbar-nav">
			<li class="dropdown">
			 <a href="#" class="dropdown-toggle" data-toggle="dropdown" >商品管理 <span class="caret"></span></a>
				<ul class="dropdown-menu">
					<li><a href="Addmerchandise.php">商品进货</a></li>
					<li><a href="merchandiseDish.php">商品列表</a></li>
				</ul>
			</li>
		  </ul>
		<ul class="nav navbar-nav">
			<li class="dropdown">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown" >营业管理 <span class="caret"></span></a>
					<ul class="dropdown-menu">
						<li><a href="#">支出明细</a></li>
						<li><a href="income.php">收入明细</a></li>
					</ul>
				</li>
			</ul>
			<ul class="nav navbar-nav">
			<li class="dropdown">
			 <a href="#" class="dropdown-toggle" data-toggle="dropdown" >我的购物车 <span class="caret"></span></a>
				<ul class="dropdown-menu">
					<li><a href="Adddesk.php">我的商品</a></li>
					<li><a href="#">消费记录</a></li>
					<li><a href="#">我的收藏</a></li>
				</ul>
			</li>
		  </ul>
			<ul class="nav navbar-nav">
			<li class="dropdown">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown" >权限管理 <span class="caret"></span></a>
					<ul class="dropdown-menu">
						<li><a href="#">我的权限</a></li>
						<li><a href="#">关于超市</a></li>
					</ul>
				</li>
			</ul>
	 	 <ul class="nav navbar-nav">
	  		<li class="dropdown">
	  			<a href="#" class="dropdown-toggle" data-toggle="dropdown" >登录管理 <span class="caret"></span></a>
	  				<ul class="dropdown-menu">
				  		<li><a href="#"  data-toggle="modal" data-target="#2">退出登录</a></li>
	  				</ul>
		</li>
	</ul>
 </div>
</div>
	<div id="2" class="modal">
					<div class="modal-dialog">				
					<div class="modal-content">
							<div class="modal-header">
								<span class="close" data-dismiss="modal">&times;</span>
								  <div class="modal-title">
									<h4>确定退出登录</h4>
								  </div>
									</div>
							<div class="modal-body">
								你确定要退出登录吗？
							</div>
							<div class="modal-footer">
							 <a type="submit" class="btn btn-default" href="logout.php">确定</a>
							 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
							</div>
						</div>
					</div>
				</div>
<div class="container">
	<div class="row" id="main">
	<div class="col-xs-12 title"></div>
	
			<div class="col-xs-3 main">
				<div class="col-xs-12 lists">
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								日用百货
							</a>
							</div>
						</div>
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								电器用品
							</a>
						</div>
						</div>
				</div>
				<div class="col-xs-12 lists">
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								零食小吃
							</a>
							</div>
						</div>
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								瓜果蔬菜
							</a>
							</div>
						</div>
				</div>
				<div class="col-xs-12 lists">
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								文体用品
							</a>
							</div>
						</div>
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								保健用品
							</a>
							</div>
						</div>
				</div>
				<div class="col-xs-12 lists">
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								家电办公
							</a>
							</div>
						</div>
						<div class="col-xs-6 list">
							<div class="deep">
							<a href="#" id="color">
								新鲜肉类
							</a>
						</div>
						</div>
				</div>
			</div>
			
			<div class="col-xs-9 search">
				<div class="col-xs-6 col-xs-offset-3">
		 					<form action="First.php" method="get">
			 					<div class="input-group">
			 						<input name="text" class="form-control" placeholder="搜索宜家超市商品" />
			 						<div class="input-group-btn">
			 							<button class="btn btn-primary" type="submit">
			 								<span class="glyphicon glyphicon-search"></span>
			 							</button>
			 						</div>
			 					</div>
		 					</form>
 				</div>
			</div>
				<div class="col-xs-9 Hpage">
					<?php 
						foreach ($list as $eitm){
					?>
					<div class="col-sm-12 col-md-4 col-lg-3">
						<div class="thumbnail" style="height: 300px">
							<img src="img/<?php echo $eitm['imgUrl']; ?>"/>
							<div class="caption text-center">
								<a  href="operateDish.php?id=<?php echo $eitm ['eId']?>"><?php echo $eitm['eName']?></a>
								<h3 id="price">￥<?php echo $eitm ['price']?></h3>
					 			<div id="div">商品类型：<?php echo $eitm['tName']; ?></div>
				 			</div>
				 		</div>
				     </div>
				     <?php }?>
			</div>
	</div>
	

</div>
</body>
</html>







